package ran.test;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ran.domain.sysuser.entity.SysUser;
import ran.mapper.sysuser.SysUserMapper;
import ran.redis.service.RedisService;

import java.util.List;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ran
 * Date: 2025-10-04
 * Time: 16:22
 */
@RestController
@RequestMapping("/test")
public class Controller {
    @Autowired
    private SysUserMapper sysUserMapper;
    @Autowired
    private RedisService redisService;
    @RequestMapping("/getList")

    public List<SysUser> getList() {
        return sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>().ne(SysUser::getUserId,0));
    }
    @RequestMapping("/setAndGet")
    public Object setAndGet() {
        SysUser sysUser = new SysUser();
        sysUser.setUserAccount("jinghua");
        sysUser.setPassword("123456");
        redisService.setCacheObject("user",sysUser);
        return redisService.getCacheObject("user",SysUser.class);
    }
}
